﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=1">
    <meta name="format-detection" content="telephone=no">
    <meta charset="UTF-8">
    <title>数组的循环</title>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script src="../js/jquery-2.2.0.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
</head>
<body>
    <h1>数组的循环</h1><br/>

    <div id="app">
        {{name}}
        <!--vue提供了一个指令v-for解决循环问题的  更高效 会复用原有结构-->
        <!--要循环谁就在谁的身上加上v-for指令-->
        <ul>
            <li v-for="(obj,i) in fruits">{{obj.name}}</li>
        </ul>

        <!---循环对象-->
        <div v-for="(value,key,index) in obj">
            key:{{key}};value:{{value}};index:{{index}}
        </div>
        <!--循环字符串-->
        <div v-for="obj in 'asd'">{{obj}}</div>
    </div>
<script src="../js/vue-2.5.16.js"></script>
<script src="../node_modules/axios/dist/axios.js"></script>
<script src="../node_modules/lodash/lodash.js"></script>

<script>
    var app = new Vue({
        el:'#app',
        data:{
            name:'模版数据',
            obj:{
                name:'qwwq',
                age:2
            },
            fruits:[
                {name:'苹果1'},
                {name:'苹果2'},
                {name:'苹果3'}
            ]
        }
    });
</script>

</body>
</html>